package com.eurasia.assignment.infrastructure.repository.adapter;

import com.eurasia.assignment.domain.User;
import com.eurasia.assignment.infrastructure.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Optional;

@Component
@RequiredArgsConstructor
public class UserPersistenceAdapter {
    private final UserRepository userRepository;
    public User save(User user) {
        return userRepository.save(user);
    }

    public Optional<User> findByUsername(String username) {
        return userRepository.findByUsername(username);
    }
}
